<?php
/**
 * 热门地点模型
 * 
 */
class AreaPopularModel extends Model {
	var $key_suff = "area_popular_list_";
	/**
	 * 查询热门地点
	 * @param unknown_type $city_id  城市
	 * @param unknown_type $area_id  城区
	 * @param unknown_type $limit    查询条数
	 */
	function getList($city_id,$area_id,$limit=null){
		$key = $this->key_suff;
		if(!empty($city_id)){
			$key = $this->key_suff.$city_id;
			$map['city_id'] = $city_id;
		}
		if(!empty($area_id)){
			$key = $this->key_suff.$area_id;
			$map['area_id'] = $area_id;
		}
		
		$populars = S($key);
		if($populars==null||empty($populars)){
			$populars = $this->where($map)->order(' item_sum desc ')->limit($limit)->findAll();
			S($key,$populars);
		}
		
		return $populars;
	}
}